window.onload = function() {
	
	$('#username').focus();

	var errorInfo = $('#error');
	$('#login-form').onsubmit = function(){
		if($('#username').value.trim() === '') {
			$('#username').focus();
			errorInfo.innerHTML = 'User ID is required';
			errorInfo.style.display = 'inline';
			return false;
		}
		if($('#password').value.trim() === '') {
			$('#password').focus();
			errorInfo.innerHTML = 'Password is required';
			errorInfo.style.display = 'inline';
			return false;
		}
	}

	function $(slctor){
		return document.querySelector(slctor);
	}
}